<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" type="text/css" href="<%=path %>/static/css/css.css?1" />
<link rel="stylesheet" type="text/css" href="<%=path %>/static/jquery-ui/jquery-ui.min.css" />
<script type="text/javascript" src="<%=path %>/static/js/json2.js"></script>
<script type="text/javascript" src="<%=path %>/static/js/jquery.js"></script>
<script type="text/javascript" src="<%=path %>/static/jquery-ui/jquery-ui.min.js"></script>
<script type="text/javascript" src="<%=path %>/static/layer/layer.js"></script>
<script type="text/javascript" src="<%=path %>/static/js/gridview.js?v=1"></script>
<script type="text/javascript" src="<%=path %>/static/js/formview.js?v=1"></script>
<script type="text/javascript" src="<%=path %>/static/js/tool.js"></script>
<script type="text/javascript" src="<%=path %>/static/js/validate.js"></script>
<script type="text/javascript" src="<%=path %>/wechat/js/copy/ZeroClipboard.js"></script>
<SCRIPT type="text/javascript">
$.ajaxSetup({
  async: false
  });
    <!--
	var gridSetting = {
			id:'QhToolCashGrid',
			po:"QhToolCash",
			title:'工具提现列表',
			height:'auto',
			service:"uiServices!listSimple",
			tbId:"QhToolCashTb",
			pageInfo: {
				records: 12,//auto表示根据容器高度自动判断
				orderby : "id desc"
			},
			oper:{
                isDisplay:true,
            	operName:"",
            	url:"",
            	cssClass:"Operation",
            	width:80
            },
			fields:[
			   {	name:'id',
					hide:true
			   },
               {
                   name: 'title',
                   descs:"标题",
                   align:"left"
               },
               {
                   name: 'taskType',
                   descs:"任务类型",
                   thstyle:"width:80px",
                   align:"center"
               },
               {
                   name: 'type',
                   descs:"类别",
                   thstyle:"width:80px",
                   align:"center"
               },
               {
                   name: 'rewardType',
                   descs:"奖励类别",
                   thstyle:"width:80px",
                   align:"center"
               },
               {
                   name: 'number',
                   descs:"数量",
                   thstyle:"width:80px",
                   align:"center"
               },
               {
				   name: 'startDate',
				   descs:"开始时间",
				   thstyle:"width:100px",
				   align:"center"
			   },{
                   name: 'endDate',
                   descs:"结束时间",
                   align:"center",
                   thstyle:"width:100px"
               },{
				   name: 'cashMoney',
				   descs:"额度",
				   align:"center",
				   thstyle:"width:80px"
			   }
			   ,{
               	   name: 'validTerm',
               	   descs:"有效期",
               	   align:"center",
               	   thstyle:"width:100px"
               }
               ,{
               	   name: 'state',
               	   descs:"状态",
               	   align:"center",
               	   thstyle:"width:60px"
               }
			]
		};
	var grid,form0;
    $(document).ready(function(){
    	grid = new GridView("list",gridSetting,"list");
		grid.init();
		var data = [];

		grid.load({data:data});

		ajustHeight();

		$("#addBtn").click(function(){
            location.href="/qh/public/common/r2.htmls?page=base/tool_cash_edit";
        });

        $("#delBtn").click(function(){
            grid.deletes("deleteMappedRoleNavis",function(ret){
                if(ret==-1){
                    layer.msg("删除失败，请重试！");
                }else{
                    layer.msg("删除" + ret.recordNum + "条记录！",function(ret){
                        grid.reload();
                    });
                }
            });
        });

    });

    //-->
</SCRIPT>
</head>

<body>
<ul class=tab_nav>
  <li>
    <a class="current" href="javascript:void(0)">工具提现</a>
  </li>
</ul>
<div class="contrainer">
<div class="rcon2" >
<table class="search_tb">
   <tr>
      <td style="padding-left:15px;">
         <select name="type" style="width:100px;">
            <option value="">类别</option>
            <option value="分享">分享</option>
            <option value="阅读">阅读</option>
            <option value="邀请">邀请</option>
         </select>
      </td>
      <td>
         <input style="float:left" type="text" name="title" placeholder="标题" />
         <input type="button" class="searchbtn" value="" id="queryBtn">
      </td>
      <td>
         <input type="button" class="btnblue" value="新增" id="addBtn" >
         <input type="button" class="btnblue" value="删除" id="delBtn"" >
      </td>
   </tr>
</table>
</div>
<div id="formview" class="rbox1"></div>
<div id="list" class="rbox2"></div>
</div>
<script type="text/javascript" src="<%=path %>/static/js/underscore.js"></script>
<script type='text/javascript' src='<%=path %>/static/My97DatePicker/WdatePicker.js'></script>
<script type='text/javascript' src='<%=path %>/dwr/engine.js'></script>
<script type='text/javascript' src='<%=path %>/dwr/util.js'></script>
<script type='text/javascript' src='<%=path %>/dwr/interface/BaseDwr.js'></script>
<script>
    $("#queryBtn").click(function(){
       var title = $(".search_tb").find(":input[name=title]").val();
       var type = $(".search_tb").find(":input[name=type]").val();
       var data = [];

       if(title!==""){
          data.push({r:"like",name:'title',value:"%"+title+"%"});
       }
       if(type!==""){
          data.push({r:"=",name:'type',value:type});
       }

       grid.load({data:data});
       ajustHeight();
    });
    function afterLoad_QhToolCashTb(){
       $(".rcon2 .mtable tbody tr").each(function(){
          var id=$(this).attr("recordid");
          var state=$(this).find("td[name=state]").attr("value");

          var html="";
          html+="<a href=<%=path %>/public/common/r2.htmls?page=base/tool_cash_edit&id="+id+" >编辑</a>";
          if(state==99){
             $(this).find("td[name=state]").text("正常");
             html+="<a href=javascript:audit("+id+",-1) style='margin-left:6px;' >停用</a>";
          }
          else{
             $(this).find("td[name=state]").text("已停用");
             html+="<a href=javascript:audit("+id+",99) style='margin-left:6px;' >启用</a>";
          }

          $(this).find(".Operation").html(html);

       });
    }
    function audit(id,state){
       $.getJSON(g_path+"/public/common/toolCashStateEdit.htmls",{id:id,state:state},function(data){
          layer.alert("操作成功！");
          grid.reload();
       });
    }
</script>
</body>
</html>